//
//  HttpRequest.h
//  JCardAPP
//
//  Created by chenhuagui on 13-4-21.
//  Copyright (c) 2013年 chenhuagui. All rights reserved.
//

/*  ASI Link with CFNetwork, SystemConfiguration, MobileCoreServices, CoreGraphics and zlib*/

#import <Foundation/Foundation.h>
#import "HttpResquestDelegate.h"
#import "JSONKit.h"

@class ASINetworkQueue;

@interface HttpRequest : NSObject<HttpResquestDelegate>
{
    ASINetworkQueue *m_queue;
    NSNumber *total;
    NSNumber *downloads;
   
}

@property (nonatomic, retain)id<HttpResquestDelegate> requestDelegate;

/**
 *	@brief	addHttpRequest 发起异步请求报文
 *
 *	@param 	action 	请求报文类型，在WebURLString.h中定义的宏
 *	@param 	dicData 	请求数据域，与action对应的请求数据域，具体参考 《集卡规范说明文档--V1.0.0--终端.docx》
 *	@param 	tag 	请求标志，由掉用方自行设置，用于在应答处理时区分是哪个报文的应答
 *	@param 	bMore 	是否获取更多，一般为NO，对于有多条数据，分批获取时，设置为YES
 *
 *	@return	<#return value description#>
 */
- (BOOL)addHttpRequest:(NSString*)action setPostData:(NSMutableDictionary *)dicData setTag:(NSString *)tag isGetMore:(BOOL)bMore;

- (BOOL)addHttpRequest:(NSString *)action setPostData:(NSMutableDictionary *)dicData setTag:(NSString *)tag isGetMore:(BOOL)bMore preUrl:(NSString *)preUrl;

+ (NSDictionary *)startSyncHttpRequest:(NSString *)action setPostData:(NSMutableDictionary *)dicData;

+ (NSDictionary *)startSyncXMLHttpRequest:(NSString *)urlString;

+ (NSDictionary *)startSyncXMLHttpRequest:(NSString *)action setUserData:(NSMutableDictionary *)postData;

+ (NSDictionary *)startSyncHttpRequest:(NSString *)urlString;

/**
 *	@brief	hasMoreData 是否有更多的数据要获取，对于有多条数据的处理时，应根据次标志判断是否有后续数据
 *
 *	@param 	dicData 	上一次请求返回的数据
 *
 *	@return	YES-有更多的数据 NO-无更多数据
 */
- (BOOL)hasMoreData:(NSDictionary *)dicData;


+ (NSDictionary *)startSyncXMLMailHttpRequest:(NSString *)action setUserData:(NSMutableDictionary *)postData;

+ (NSDictionary *)startSyncXMLGetUnReadHttpRequest:(NSString *)action setUserData:(NSMutableDictionary *)postData;
+ (NSDictionary *)startSyncJsonHttpRequest:(NSString *)action setUserData:(NSMutableDictionary *)postData;
@end
